//
//  PopoverViewDemoViewController.swift
//  ZZUIDemo
//
//  Created by 张文晏 on 2018/11/20.
//  Copyright © 2018 Newcoretech. All rights reserved.
//

import UIKit
import ZZUI

class PopoverViewDemoViewController: UIViewController {
    
    @IBAction func baseStyleAction(_ sender: UIButton) {
        let customView = UIView()
        let label = UILabel()
        label.text = "这是自定义 View"
        customView.addSubview(label)
        label.snp.makeConstraints { $0.edges.equalToSuperview() }
        let pv = PopoverView()
        pv.show(to: sender, view: customView, width: 160, height: 300)
    }
    
    @IBAction func tableViewStyleAction(_ sender: UIButton) {
        let pv = PopoverView()
        let action1 = PopoverAction(title: "item1") { _ in
            print("item1 clicked")
        }
        let action2 = PopoverAction(title: "item2") { _ in
            print("item2 clicked")
        }
        let action3 = PopoverAction(title: "item3") { _ in
            print("item3 clicked")
        }
        pv.show(to: sender, with: [action1, action2, action3])
    }
    
}
